1. Field of the Invention
The present invention relates to a circuit for detecting a motion vector and carrying out motion-compensated interframe predictive coding in an encoder for compressing picture data and the like.
2. Description of the Related Art
An MPEG (Moving Picture Experts Group) standard is known as a typical coding standard for compressing a motion picture. The MPEG standard includes an MPEG 1 standard for storage media and an MPEG 2 standard for general purpose. Each of them is a system utilizing both a motion-compensated predictive coding and a discrete cosine transform (DCT).
FIG. 2 is a diagram for showing a basic arrangement of an MPEG encoder. An A/D converter 11 converts a video signal formed of a luminance signal Y and color difference signals Cb, Cr supplied thereto into a digital signal and then supplies it to a format converting circuit 12. The format converting circuit 12 converts a format of the supplied digital signal into a signal having a spatial resolution used for encoding, and then supplies the converted signal to a frame arranging circuit 13. The frame arranging circuit 13 re-arranges the supplied video signal by a frame unit in response to picture types of an intra-coded picture (I picture), a predictive-coded picture (P picture) and a bidirectionally predictive-coded picture (B picture), in order to encode a B picture by using frames preceding and succeeding the B picture as a function of time.
A motion detecting circuit 14 (including an integer pixel accuracy calculating unit 14a and a half pixel accuracy calculating unit 14b) and a motion compensative prediction circuit 15 generate a predictive picture described later on, and then supply the predictive picture to a subtracter 16. The subtracter 16 is supplied also with the picture from the frame arranging circuit 13, and calculates a difference (i.e., a predictive error picture) between the predictive picture and the picture supplied from the frame arranging circuit 13.
A DCT circuit 17 is supplied with the predictive error picture from the subtracter 16 and DCT encodes the predictive error picture. A quantizer circuit 18 quantizes the predictive error picture from the DCT circuit 17 and then supplies it to a variable length coding circuit 19. The variable length coding circuit 19 variable-length-codes the supplied predictive error picture together with the motion vector supplied from the motion detecting circuit 14 and so on, and then supplies the encoded data to a buffer memory 20 for storing the encoded data. The encoded data is output from the buffer memory 20 in a format of a coded bit stream according to the MPEG standard.
If a picture is the I picture or the P picture, then an information about information at the quantizing circuit 14 is restored to a predictive error picture by an inverse quantizer circuit 21 and an inverse DCT circuit 22 in order to employ the picture as a reference frame for the succeeding motion detecting processing and the succeeding motion compensative prediction processing. The predictive error picture from the inverse DCT circuit 22 and the predictive picture from the motion compensative prediction circuit 15 are added by an adder 23, and then stored in a frame memory 24.
FIG. 3 is a diagram showing a principle of a processing carried out the motion detecting circuit 14 and the motion-compensation predicting coding circuit 15, of the processings of the MPEG encoder. A portion Y (shown in FIG. 3B) most approximate to an object X (shown in FIG. 3A) of a current frame is detected from a reference frame (i.e., a frame succeeding or preceding the current frame), and a movement amount from a position of the object X to a position of the portion Y is detected as a motion vector VC (as shown in FIG. 3C). The motion vector VC is generally detected with respect to a picture in each of plural small blocks into which a frame is divided (a block matching method).
The portion Y in the reference frame is shifted by using the motion vector, thereby a predictive picture Y' in the current frame being generated (as shown in FIG. 3D). A predictive error picture Z (shown in FIG. 3E) which a difference between the object X and the predictive picture Y' is calculated, and then is to be encoded.
The motion detecting circuit 14 and the motion compensative prediction circuit 15 have arrangements shown in FIGS. 4 to 6 which are diagrams showing function blocks thereof in order to detect the motion vector and generate a predictive coded picture.
As shown in FIG. 4, an integer pixel accuracy calculating unit 14a of the motion detecting circuit 14 derives from the frame memory 24 picture data of block units of the current frame (reference block data BD) and picture data of blocks in a predetermined search area of a reference frame (i.e., a frame preceding or succeeding the current frame) (search data SD).
The integer pixel accuracy calculating unit 14a calculates, by using an integer pixel accuracy, a portion (e.g., the portion Y shown in FIG. 3B) most approximate to the object (i.e., the object X shown in FIG. 3A) of the current frame and its position with respect to each of the preceding reference frame and the succeeding reference frame. The integer pixel accuracy calculating unit 14a supplies data OD indicative of a result of this calculation to a half pixel accuracy calculating unit 14b of the motion detecting circuit 14 together with the search data SD from the frame memory 24.
As shown in FIG. 5, in the half pixel accuracy calculating unit 14b, the calculation result data OD and the search data SD are input through a buffer memory 31 thereof to a pixel data input unit 32 thereof. The pixel data input unit 32 has a function to rearrange the picture data by a pixel unit. The pixel data input unit 32 can rearrange the picture data so that a picture data at the position calculated by the integer pixel accuracy calculating unit 14a and picture data at the positions above and under the position should be located side by side, so that a picture data at the position calculated by the integer pixel accuracy calculating unit 14a and picture data at the positions on the left and right sides of the position should be located side by side, and so that a picture data at the position calculated by the integer pixel accuracy calculating unit 14a and picture data at the positions diagonally above and under the position should be located side by side.
An interpolation pixel data generating unit 33 has a function to carry out a linear interpolation calculation. The interpolation pixel data generating unit 33 subjects to the linear interpolation the picture data at the position obtained by the integer pixel accuracy calculating unit 14a and the picture located by the pixel data input unit 32 at the side of the above picture data, calculating picture data ID at eight positions displaced from the position calculated by the integer pixel accuracy calculating unit 14a in the upward, downward, left, right and diagonal directions by a unit of half pixel (0.5 pixel).
A subtracter 34 calculates difference between each of the picture data ID and the reference block data BD supplied thereto from the frame memory 24 (shown in FIG. 2) through the pixel data input unit 32. A residual comparing unit 35 compares magnitudes of these differences and detects a position with the smallest difference to output an amount of movement between the position and a position of the object as a motion vector VC (as shown in FIG. 3C).
The respective motion vectors VC are detected with half-pixel accuracy with reference to the succeeding and preceding reference frames as described above. The half pixel accuracy calculating unit 14b supplies these motion vector to the motion compensative prediction circuit 15 and also to the variable-length coding circuit 19.
As shown in FIG. 6, the motion compensative prediction circuit 15 is input, through a buffer memory 41, with the motion vector VC from the half-pixel accuracy calculating unit 14b and with the search data SD from the frame memory 24. A pixel data input unit 42 has a function to re-arrange a picture data by a pixel unit. The pixel data input unit 42 re-arranges the picture data so as to shift picture data of portions most approximate to the object in the preceding and succeeding reference frame by using the respective motion vectors vc, thereby generating the predictive-coded picture data FD (data indicative of the portion Y' shown in FIG. 3D) in the current frame from the preceding and succeeding reference frames.
An interpolation pixel data generating unit 43 has a function to carry out linear interpolation calculation. The interpolation pixel data generating unit 43 subjects to linear interpolation the predictive-coded picture data FD generated from the preceding reference frame by the pixel data input unit 42 and the predictive-coded picture data FD generated thereby from the succeeding reference frame, thereby calculating an average predictive-coded picture data AFD obtained by averaging the both predictive-coded picture data FD. Then, the interpolation pixel data generating unit 43 supplies the predictive-coded picture data AFD calculated thereby to a subtracter 44.
The subtracter 44 is supplied with the above predictive-coded picture data AFD from the interpolation pixel data generating unit 43 to calculate a predictive error picture data EFD (i.e., data indicative of the portion Z shown in FIG. 3E) which is a difference between the predictive-coded data AFD and a reference block data BD supplied from the frame memory (shown in FIG. 2) through the pixel data input unit 42. The predictive-coded picture data AFD calculated by the interpolation pixel data generating unit 43 is also supplied to the adder 23 shown in FIG. 2 as described above.
Since various equipments (e.g., a video cassette recorder and so on) mounted with an MPEG encoder or other picture compression encoders gradually tends to be downsized, efforts and attention have been focused on further miniaturization of a circuit scale of each of such encoders.